Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples/reuse example, showing how to add fields to Lists in a re-usable way #8837

Merged
merged 7 commits into from
Sep 26, 2023

Conversation

dcousens
Copy link
Member

@dcousens dcousens commented Sep 26, 2023

This pull request addresses a commonly requested example of how to build lists that share the same set of fields, including field hooks and other properties.

The problem is how to interoperate with these lists in a way that is type safe in Typescript, without falling back to casting as any or falling back on BaseListTypeInfo or similar.
We always want to use the refined types, but that can be difficult.

For now, we're only adding one example of this, a typical set of createdBy and createdAt fields.

Lastly, this pull request exports FieldHooks, which was required to demonstrate hook re-usability, and unfortunately missing from our type exports.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 26, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5da601d:

Sandbox Source
@keystone-6/sandbox Configuration

@dcousens dcousens self-assigned this Sep 26, 2023
@dcousens dcousens merged commit 650fae5 into main Sep 26, 2023
57 checks passed
@dcousens dcousens deleted the reuse-example branch September 26, 2023 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants